/**
*****************************************************************************
* @addtogroup SL_IPC
* @{
* Copyright (C) 2018 LAN-YOU(GuangZhou). All rights reserved
*
* @par Project:
*      TCU
*
* @par Module:
*      IPC Event
*
* @par Usage Notes:
*      It is a communication middleware for application to set up one to one
*      or one to many communication channel.
*
* @par Author:
*      Nick HUANG
*
*****************************************************************************
*/

#ifndef __IPC_EVENT_UTIL_H__
#define __IPC_EVENT_UTIL_H__

namespace ipc_event
{
  /**
    *********************************************************************************
    *
    * @brief message decode/encode utility
    *
    * @param	Purpose:
    *			it is convenient for application developer to handle the message
    *			encode / decode.
    *
    * @param	Usage notes:
    *			-
    *
    *********************************************************************************
  */
  class IPCMsgUtils
  {
    public:
      static int compile(char * buffer , int offset , int value , int length = sizeof(int));
      static int compile(char * buffer , int offset , short value , int length = sizeof(short));
      static int compile(char * buffer , int offset , void * data , int length);

      static int parse(char * buffer , int offset , int & value , int length = sizeof(int));
      static int parse(char * buffer , int offset , short & value , int length = sizeof(short));
      static int parse(char * buffer , int offset , void * data , int length);
  };
}

/// @}
#endif

